// 用户相关的所有请求
import { request } from "@/utils";
//1.登录请求
export function getChannelAPI() {
    return request({
        url: '/channels',
        method: 'get',
    })
}

//2.提交文章表单
export function createArticleAPI(data) {
    return request({
        url: '/mp/articles?draft=false',
        method: 'post',
        data
    })
}

//获取文章列表
export function getArticleListAPI(params) {
    return request({
        url: 'mp/articles',
        method: 'get',
        params
    })
}

//删除文章
export function delArticleAPI(articleId) {
    return request({
        url: `/mp/articles/${articleId}`,
        method: 'delete'
    })
}

//获取文章详情
export function getArticleByIdAPI(articleId) {
    return request({
        url: `/mp/articles/${articleId}`,
        method: 'get'
    })
}


//更新文章
export function updateArticleByIdAPI(articleId, data) {
    return request({
        url: `/mp/articles/${articleId}?draft=false`,
        method: 'put',
        data
    })
}   